package com.cust.cow.controller;

import com.cust.cow.common.Result;
import com.cust.cow.pojo.matingLog;
import com.cust.cow.service.MatingLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/matingLog")
@CrossOrigin("*")
public class MatingLogController {
    @Autowired
    MatingLog matingLogService;

    @RequestMapping("findMatingLogAll")
    public List<matingLog> findMatingLogAll()
    {
        return matingLogService.findMatingLogAll();
    }

    @PostMapping("insertMatingLog")
    public Result insertMatingLog(@RequestBody matingLog matingLog)
    {
        return matingLogService.insertMatingLog(matingLog);
    }

    @RequestMapping("deleteMatingLog")
    public Result deleteMatingLog(@RequestParam("cattleId") Integer cattleId)
    {
        return matingLogService.deleteMatingLog(cattleId);
    }

    @PostMapping("updateMatingLog")
    public Result updateMatingLog(@RequestBody matingLog matingLog)
    {
        return matingLogService.updateMatingLog(matingLog);
    }
}
